﻿{% extends 'base.html' %}
<!--覆写title区块 -->
{% block title %}查询结果{% endblock %}
 <!--覆写content区块 -->
{% block content %}
<script type="text/javascript">
function myFunction(ID,TYPE)
{
	id="#"+ID;
	//var URL="http://120.77.57.236:8080/feedback/like"+"?id="+ID+"&type="+TYPE;
	//var URL="/like?id="+ID+"&type="+TYPE; 
	$.get("/like/",{'id':ID,'type':TYPE},$(id).show());
}
</script>
<div class="container">
	<!--导航栏 -->
	<div class="row" id="nav">
		<div class="col-md-11">
		<span></span>
		<ul class="nav nav-tabs">
			  <li role="presentation" {%ifequal weight '2'%}class="active"{% endifequal %}>{%if res_paper%}<a href='/recommend/?id={{res_paper.id}}&type=paper&weight=2'>标准</a>{% else %}<a href='/recommend/?id={{res_book.id}}&type=book&weight=2'>标准</a>{% endif%}</li>
			  <li role="presentation" {%ifequal weight '1'%}class="active"{% endifequal %}>{%if res_paper%}<a href='/recommend/?id={{res_paper.id}}&type=paper&weight=1'>精确</a>{% else %}<a href='/recommend/?id={{res_book.id}}&type=book&weight=1'>精确</a>{% endif%}</li>
			  <li role="presentation" {%ifequal weight '3'%}class="active"{% endifequal %}>{%if res_paper%}<a href='/recommend/?id={{res_paper.id}}&type=paper&weight=3'>多样</a>{% else %}<a href='/recommend/?id={{res_book.id}}&type=book&weight=3'>多样</a>{% endif%}</li>
			  <li style="float:right "><a class="btn btn-primary" type="button" href="/">返回主页</a></li>
		</ul>
		</div>
	</div>
	<div class="row" id="icon">
		<div class="col-md-11">
		<span class="glyphicon glyphicon-cloud" aria-hidden="true"></span>
		<span>以下结果根据 <b>{%if res_paper%}{{res_paper.title}}{% else %}{{res_book.title}}{% endif%}</b> 进行
		<b>{%ifequal weight '1'%}精确{% endifequal %}
			{%ifequal weight '2'%}标准{% endifequal %}
			{%ifequal weight '3'%}多样{% endifequal %}
			</b>推荐</span>
		</div>
	</div>
	<!--展示推荐结果 -->
	<div class="row" id="content">
		<div class="col-md-6" style="min-height:550px;overflow-y:auto;max-height:300px;font-size:20px;">
		<a href="#" class="list-group-item active">图书推荐结果</a>
		<!--展示前提json格式数据非空 -->
		{% if res_rec_book %}
			<table class="table table-hover table-condensed">
					<tr class="info" style="height:75px;">
						<td>标题</td>
						<td>作者</td>
						<td>标识</td>
						<td>分类</td>
						<td><font size="2px">出版日期</font ></td>
						<!--<td><font size="2px">点击数</font></td>-->
					</tr>
					{%for item in res_rec_book%}
					<tr data-toggle="modal" data-target="#myModal{{item.callId}}">
					<!-- 模态框（Modal） -->
					<div class="modal fade" id="myModal{{item.callId}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
									<h4 class="modal-title" id="myModalLabel">《{{item.title}}》的详细资料</h4>
								</div>
								<div class="modal-body">图书ID：{{item.callId}}<br>作者：{{item.author}}<br>出版社：{{item.publisher}}<br>出版年月：{{item.pubYear}}<br>中图法分类：{{item.callName}}</div>
								<div class="modal-footer">
									<label id="{{item.id}}" style="color: red;display: none">谢谢反馈！</label>
									<button type="button" class="btn btn-primary" onclick="myFunction({{item.id}},'book')" id="bookLike">赞</button>
									<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
								</div>
							</div><!-- /.modal-content -->
						</div><!-- /.modal -->
					</div>
						<td><font size="2px"><a href='/recommend/?id={{item.id}}&type=book&weight='>{{item.title}}</a></font></td>
						<td><font size="2px">{{item.author}}</font></td>
						<td><font size="2px">{{item.callId}}</font></td>
						<td><font size="2px">{{item.callName}}</font></td>
						<!--<td>{{item.publisher}}</td>-->
						<td><font size="2px">{{item.pubYear}}</font></td>
						<!--<td>{{item.likeCount}}</td>-->
					  </tr>
					 {%endfor%}
			</table>
		{%else%}
		<!--若无数据则随机推荐 -->
		<span> &nbsp &nbsp &nbsp <font size=2px>抱歉！系统并未有关于<b>{%if res_paper%}{{res_paper.title}}{% else %}{{res_book.title}}{% endif%}</b> 的图书推荐</font></span>
		<br>&nbsp &nbsp &nbsp <font size=2px>你可以看看</font>：
			<a href="#" class="list-group-item active">随机图书鉴赏</a>
			<ul class="list-group"  style="min-height:250px;overflow-y:auto;max-height:300px;">
				{%for item in res_book_r%}
			  <li style="font-size:2px"class="list-group-item" data-toggle="modal" data-target="#myModal{{item.callId}}"><a href='/recommend/?id={{item.id}}&type=book&weight='>{{item.title}}</a></li>
				<!-- 模态框（Modal） -->
					<div class="modal fade" id="myModal{{item.callId}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
									<h4 class="modal-title" id="myModalLabel">《{{item.title}}》的详细资料</h4>
								</div>
								<div class="modal-body">图书ID：{{item.callId}}<br>作者：{{item.author}}<br>出版社：{{item.publisher}}<br>出版年月：{{item.pubYear}}<br>中图法分类：{{item.isbn}}</div>
								<div class="modal-footer">
									<label id="{{item.id}}" style="color: red;display: none">谢谢反馈！</label>
									<button type="button" class="btn btn-primary" onclick="myFunction({{item.id}},'book')" id="bookLike">赞</button>
									<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
								</div>
							</div><!-- /.modal-content -->
						</div><!-- /.modal -->
					</div>{%endfor%}
			</ul>
			<!--推荐books：<br>
			{%for item in res_book%}
			{{item.title}}<br>
			{%endfor%}!-->
		{%endif%}
		</div>
		<div class="col-md-5" style="min-height:550px;overflow-y:auto;max-height:300px;font-size:20px;">
		<a href="#" class="list-group-item active">论文推荐结果</a>
		{%if res_rec_paper%}
			<table class="table table-hover table-condensed" >
					<tr class="info" style="height:75px;">	
						<td>标题</td>
						<td>来源</td>
						<td>ID</td>
						<td><font size="2px">关键词</font></td>
						<!--<td><font size="2px">点击数</font></td>-->	
					</tr>
					{%for item in res_rec_paper%}
					 <tr title={{item.intro}} data-toggle="modal" data-target="#myModal{{item.id}}">
				    <!-- 模态框（Modal） -->
					<div class="modal fade" id="myModal{{item.id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
									<h4 class="modal-title" id="myModalLabel">《{{item.title}}》的详细资料</h4>
								</div>
								<div class="modal-body">论文ID：{{item.paperId}}<br>链接：{{item.url}}<br>简介：{{item.intro}}</div>
								<div class="modal-footer">
									<label id="{{item.id}}" style="color: red;display: none">谢谢反馈！</label>
									<button type="button" class="btn btn-primary" onclick="myFunction({{item.id}},'paper')" id="bookLike">赞</button>
									<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
								</div>
							</div><!-- /.modal-content -->
						</div><!-- /.modal -->
					</div>
							<td><font size="2px"><a href='/recommend/?id={{item.id}}&type=paper&weight='>{{item.title}}</a></font></td>
							<td><font size="2px">{{item.author}}</font></td>
							<!--<td><font size="2px"><a href={{item.url}}>{{item.paperId}}</a></font></td>-->
							<td><font size="2px">{{item.field}}</font></td>
							<td><font size="2px">{{item.indexTerm}}</font></td>
					  </tr>
					 {%endfor%}
				</table>
			{%else%}
			<span> &nbsp &nbsp &nbsp <font size=2px>抱歉！系统并未有关于<b>{%if res_paper%}{{res_paper.title}}{% else %}{{res_book.title}}{% endif%}</b> 的论文推荐</font></span>
			<br>&nbsp &nbsp &nbsp <font size=2px>你可以看看</font>：
			<a href="#" class="list-group-item active">随机论文鉴赏</a>
			<ul class="list-group" style="min-height:250px;overflow-y:auto;max-height:300px;">
				{%for item in res_paper_r%}
			  <li style="font-size:2px"class="list-group-item" title={{item.intro}} data-toggle="modal" data-target="#myModal{{item.id}}"><a href='/recommend/?id={{item.id}}&type=paper&weight='>{{item.title}}</a></li>
				<!-- 模态框（Modal） -->
					<div class="modal fade" id="myModal{{item.id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
									<h4 class="modal-title" id="myModalLabel">《{{item.title}}》的详细资料</h4>
								</div>
								<div class="modal-body">论文ID：{{item.paperId}}<br>链接：{{item.url}}<br>简介：{{item.intro}}</div>
								<div class="modal-footer">
									<label id="{{item.id}}" style="color: red;display: none">谢谢反馈！</label>
									<button type="button" class="btn btn-primary" onclick="myFunction({{item.id}},'paper')" id="bookLike">赞</button>
									<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
								</div>
							</div><!-- /.modal-content -->
						</div><!-- /.modal -->
					</div>{%endfor%}
			</ul>
			{%endif%}	
	</div>
	</div>
</div>
{% endblock %}